package kassiopeia.agent.bootstrap.logger;

/**
 * <p>We strongly avoid using ANY external classes in bootstrap module, because classes visible to
 * this module will be also visible to plugin instances - which is very DANGEROUS and unnecessary
 * (because bootstrap module is loaded by SYSTEM class loader).
 * 
 * <p>That's why we don't want to use log4j here - we use very simple "logger" implementation instead.
 * 
 * @author Kamil
 *
 */
public class SimpleLogger {

	public static final String INFO_PREFIX  = " [INFO] ";
	public static final String ERROR_PREFIX = " [ERROR] ";
	
	private String className;
	
	public SimpleLogger(String clazz) {
		this.className = clazz;
	}
	
	public void info(String message) {
		System.out.println(INFO_PREFIX + "[" + className + "] " + message);
	}
	
	public void error(String message) {
		System.out.println(ERROR_PREFIX + "[" + className + "] " + message);
	}
	
	public static SimpleLogger getLogger(Class<?> clazz) {
		return new SimpleLogger(clazz.getSimpleName());
	}
	
	public void infoInBrackets(String message) {
    	info("----------------------------------------------------------------");
        info(message);
        info("----------------------------------------------------------------");
    }
    
    public void errorInBrackets(String message) {
    	error("----------------------------------------------------------------");
        error(message);
        error("----------------------------------------------------------------");
    }
}
